-
Notifications
You must be signed in to change notification settings - Fork 1.1k
INT-4231: Add FileExistsMode.REPLACE_IF_MODIFIED #2062
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
JIRA: https://jira.spring.io/browse/INT-4231 For `FileWritingMessageHandler` and (S)FTP outbound gateways, support `FileExistsMode.REPLACE_IF_MODIFIED` to allow overwriting an existing file if the source file modified time is different to the existing file.
|
@garyrussell , would you mind taking a look to my comment in JIRA: https://jira.spring.io/browse/INT-4231?focusedCommentId=135599&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-135599 ? |
|
There are a couple errors with JavaDocs according Travis: |
| Assert.isTrue(!FileExistsMode.APPEND.equals(mode) || !this.useTemporaryFileName, | ||
| "Cannot append when using a temporary file name"); | ||
| Assert.isTrue(!FileExistsMode.REPLACE_IF_MODIFIED.equals(mode), | ||
| "FilExistsMode.REPLACE_IF_DIFFERENT can only be used for local files"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overdid. There is no such a constant FilExistsMode.REPLACE_IF_DIFFERENT 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doh - this was a last-minute change.
| <xsd:documentation><![CDATA[ | ||
| If the local file already exists, it will be overwritten only | ||
| if the last modified timestamp does not match the source | ||
| time stamp. Only applies to local files. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think no reason in the whitespace, like you don't have it in other places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?? please explain further.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In other places it is like timestamp, but here it is some how like time stamp.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah - yes - in future it would be clearer if you said s/time stamp/timestamp/, or explicitly "space between time and stamp" rather than a general statement 😄
| command="mget" | ||
| expression="payload" | ||
| command-options="-R -P" | ||
| mode="REPLACE_IF_DIFFERENT" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
??? REPLACE_IF_MODIFIED ?
Otherwise:
Caused by: java.lang.IllegalStateException: Cannot convert value of type 'java.lang.String' to required type 'org.springframework.integration.file.support.FileExistsMode' for property 'fileExistsMode': no matching editors or conversion strategy found
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:294)
at org.springframework.beans.AbstractNestablePropertyAccessor.convertIfNecessary(AbstractNestablePropertyAccessor.java:572)
... 54 more
| command="mget" | ||
| expression="payload" | ||
| command-options="-R -P" | ||
| mode="REPLACE_IF_DIFFERENT" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DITTO
src/reference/asciidoc/file.adoc
Outdated
| The following options exist: | ||
|
|
||
| * REPLACE (Default) | ||
| * REPLACE_IF_DIFFERENT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DITTO
| The flush predicates for the `FileWritingMessageHandler` now have an additional parameter. | ||
| See <<file-flushing>> for more information. | ||
|
|
||
| The file outbound channel adapter (`FileWritingMessageHandler`) now supports the `REPLACE_IF_DIFFERENT` `FileExistsMode`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DITTO
|
Merged as 2d4a7cf |
JIRA: https://jira.spring.io/browse/INT-4231
For
FileWritingMessageHandlerand (S)FTP outbound gateways, supportFileExistsMode.REPLACE_IF_MODIFIEDto allow overwriting an existing file ifthe source file modified time is different to the existing file.